#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2018/1/24 16:30
# @Author  : yuxi
# @Site    : 
# @File    : maca.py
# @Software: PyCharm

import os
import time
import subprocess
# from utils.readconfig import *

# cmd='macaca server --verbose'
# data=os.system(cmd)
# print(data)
cmd1='netstat -aon | findstr "3456"'
data=os.popen(cmd1).read().split(' ')
print(data[len(data)-1])


# cmd2='taskkill /f /pid 2440'
# data=os.system(cmd2)
# print(data)

class macacaOperation(object):

    def startMacaca(self):
        cmd = 'macaca server --verbose'
        data=os.popen(cmd)
        return data

    def closeMacaca(self):
        cmd = 'netstat -aon | findstr "3456"'
        data = os.popen(cmd).read().split(' ')
        macacaPid=data[len(data)-1]
        cmd2 = 'taskKill /f /pid '+macacaPid
        data2 = os.system(cmd2)
        return data2
